<?php
include("../common.php");
if(strlen($_GET['org']) > 2){
	$c = connectToExternalDB();
	if(isset($_GET['country']))
		$r = mysql_query("SELECT org_name FROM org 
		WHERE org_name LIKE '".$_GET['org']."%'
		AND countryid IN (SELECT countryid FROM country 
		WHERE country = '".$_GET['country']."')");
	else
		$r = mysql_query("SELECT org_name FROM org 
		WHERE org_name LIKE '".$_GET['org']."%'");

	while($row = mysql_fetch_array($r))
		echo $row[0].",";
	mysql_close($c);
}
?>
